''' PT Practice #1 Modify Pixels1_matrix ''' from codex import * from time import sleep import random pix_list1 = [ [(77, 158, 100), 75], [YELLOW, 50], [(203, 182, 6), random.randrange(100)], [RED, 50], [random.choice(COLOR_LIST), 100], [YELLOW, 75], [BLACK, 0] ] pix_list2 = [ [RED, 50], [GREEN, 50], [BLUE, 75], [YELLOW, 100], [PINK, 40], [ORANGE, 80], [CYAN, 60], [PURPLE, 50], [WHITE, 25] ] delay = 1 def random_color(): red = random.randrange(256) green = random.randrange(256) blue = random.randrange(256) color = (red, green, blue) turn_pixels(color, 100, 1) def turn_pixels(choice): if choice == 1: the_list = pix_list1 else: the_list = pix_list2 for index in range(len(the_list)): for pix in range(4): pixels.set(pix, the_list[index][0], the_list[index][1]) sleep(delay) # === Main program while True: if buttons.was_pressed(BTN_A): turn_pixels(1) if buttons.was_pressed(BTN_B): turn_pixels(2) if buttons.was_pressed(BTN_D): pixels.off() break